{include file="admin/header.htm"}
<form action="{$smarty.const.ADMIN_NAME}?m=admin&c=cat&a=man_cat" method="post" name="myform" onSubmit="return checkForm()">
<table cellpadding="2" cellspacing="1" class="table_form">
    <caption>添加分类</caption>
    <tr>
        <th><strong>分类名</strong></th>
        <td><input type="text" name="cat_name" value="{$cat.cat_name}"></td>
        <td><input type="submit" name="doadd" value=" 确定 " class="button_style"></td>
    </tr>
</table>
{if $parentid > 0}<input type="hidden" name="parentid" value="{$parentid}">{/if}
</form>

<table align="center" cellpadding="0" cellspacing="1" class="table_list">
    <caption>管理分类</caption>
    <tr>
        <th width="5%">ID</th>
        <th width="20%">分类名称</th>
        <th width="15%">状态</th>
        <th>管理操作</th>
    </tr>
    
    {foreach $cats.items as $v}
    <tr>
        <td class="align_c">{$v.id}</td>
        <td class="align_c">{$v.cat_name}</td>
        <td class="align_c">{if $v.flag eq 0}已启用{else}已禁用{/if}</td>
        <td class="align_c">
            <a href="{$smarty.const.ADMIN_NAME}?m=admin&c=cat&a=man_cat&op=addcat&parentid={$v.id}">添加分类</a> |
            <a href="{$smarty.const.ADMIN_NAME}?m=admin&c=cat&a=man_cat&op=addcat&id={$v.id}">编辑</a> |
            <a href="{$smarty.const.ADMIN_NAME}?m=admin&c=cat&a=man_cat&parentid={$v.id}">查看分类</a> |
            <a href="{$smarty.const.ADMIN_NAME}?m=admin&c=cat&a=man_cat&op=stop&flag={if $v.flag eq 1}0{else}1{/if}&id={$v.id}">{if $v.flag eq 1}启用{else}禁用{/if}</a> |
            <a href="javascript:deleteConfirm('{$smarty.const.ADMIN_NAME}?m=admin&c=cat&a=man_cat&op=delete&id={$v.id}')">删除</a>
        </td>
    </tr>
    {/foreach}
</table>
<div class="viciao" style="margin:5px 7px;">{$cats.pages}</div>
{include file="admin/footer.htm"}
<script language="javascript">
function deleteConfirm(url) {
    if(window.confirm('删除此分类会连带删除从属于它的子分类，确定删除吗？')) {
        location.href = url;
    }
}
</script>